// ==UserScript==
// @name         阅读 - 优化阅读网站的UI
// @namespace    http://tampermonkey.net/
// @version      1
// @description  1.每日新闻联播 - 文字版本 | 把握每日政经动态，在这里读懂中国
// @author       You
// @match        http://mrxwlb.com/*
// @icon         http://wuweijun.fun/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  // 控制目标和具体的事件
  var data = [
    {
      // hostname: '', styleTag: '', fun: function () {},
      hostname: 'mrxwlb.com', styleTag: '#primary', fun: function () {
        let secondary = document.getElementById('primary');
        secondary.style.width = 'auto';
        secondary.querySelector('ul').style.textIndent = '0em';
      },
    },
  ]
  let target = []; // 内容文本样式
  for (let index = 0; index < data.length; index++) {
    const element = data[index];
    if (location.href.includes(element.hostname)) {
      try { target.push(element.styleTag); element.fun && setTimeout(() => { element.fun() }, 10); }
      catch (error) { console.log(error) }
    }
  }

  // 创建新的style标签
  var style = document.createElement('style');
  // 内容文本样式
  //  target = [ '#primary', ]
  var styleString = `
     /* text-indent: 2em !important;*/
     text-indent: 2em !important;
    letter-spacing: 1px !important;
    font-size: 23px !important;
    font-family: KaiTi !important;
    /* font-family: SourceHanSansSC-Regular, SourceHanSansCN-Regular, PingFangSC-Regular, \"Microsoft YaHei\", system-ui, -apple-system, \"Segoe UI\", Roboto, Emoji, Helvetica, Arial, sans-serif !important;*/
    color: rgb(54 39 39 / 90%) !important;
    line-height: 1.8 !important;
    margin-bottom: 57px !important;
`

  // 设置样式内容
  try {
    style.innerHTML = `
      ${target.join(',')} {${styleString}}
    `;
  } catch (error) { }

  // 将style标签添加到head元素中
  document.head.appendChild(style);

}
)();
